<template>
	<div>
		<van-nav-bar
		  title="购物车"
		  left-text="返回"
		  right-text="按钮"
		  left-arrow
		  @click-left="onClickLeft()"
		  @click-right="onClickRight()"
		/>
		<div v-for="shopgood in shopgoods" :key="shopgood">
			<van-row>
				<van-checkbox v-model="checked" checked-color="red"/>
				<van-card
				  tag="爆款"
				  :price="shopgood.price"
				  :title="shopgood.descs"
				  :thumb="shopgood.thumb"
				/>
			</van-row>
			<van-row>
				<div v-if="checked==true">
					<van-submit-bar :price="shopgood.price*100" button-text="提交订单" @submit="onSubmit" />
				</div>
				<div v-else>
					<van-submit-bar :price="0" button-text="提交订单" @submit="onSubmit"/>
				</div>
			</van-row>
		</div>
		<div style="height: 18.75rem;"></div>
	</div>
	<div style="margin-bottom: 0px;">
				<van-sticky>
					<van-tabbar v-model="active" route>
					  <van-tabbar-item replace to="/main" icon="home-o">首页</van-tabbar-item>
					  <van-tabbar-item replace to="/goodsort" icon="search">分类</van-tabbar-item>
					  <van-tabbar-item replace to="/shopcat" icon="friends-o">购物车</van-tabbar-item>
					  <van-tabbar-item replace to="/goods"  icon="manager-o">订单</van-tabbar-item>
					</van-tabbar>
				</van-sticky>
	</div>
</template>

<script>
	export default {
	  data() {
	    return {
	      checked: false,
		  shopgoods:[
			  {
				  // tag:"标签",
				  // price:1000,
				  // descs:"商品标题",
				  // thumb:"https://img.yzcdn.cn/vant/ipad.jpeg"
			  }
		  ],
	    }
	  },
	   methods: {
	      onClickLeft() {
			this.$router.push("/main") 
	      },
	      onClickRight() {
	        Toast('按钮');
	      },
		  selectAll(){
			  this.axios.get("http://localhost:9999/api/oss/shopcatAll").then((res) =>{
			  	this.shopgoods=res.data.data;
			  })
		  }
	    },
		mounted() {
			this.selectAll()
		}
	};
</script>

<style>
</style>
